# Sustainable Office Designer
# by Fabian Ritter <Fabian.Ritter@live.de>, 2012

require("SOD/model/SketchInfoContainer")
require 'SOD/ConstructionManager'
require 'SOD/model/footprint'
require 'SOD/model/projectInfo'
require("SOD/model/ModelInterface")
require("SOD/tools/OpenStudio/Collection")

require("SOD/model/drawVolumeModel")
require("SOD/model/drawConstructionModel")

module SOD
  
  class ModelManager
    
    attr_reader :projectInfo
    attr_reader :sketchInfoContainer
    attr_reader :drawVolumes, :drawStructure
    
    def initialize
      
    end
    
    def start
      
      @bars = Collection.new
      
      @sketchInfoContainer = SketchInfoContainer.new
      @constructionManager = ConstructionManager.new
      @projectInfo = ProjectInfo.new
      
      @drawVolumes = DrawVolumeModel.new
      @drawStructure = DrawConstructionModel.new
      
      #@footprint = Footprint.new
      
    end
    
    def addBar
      l = @bars.length
      bar = ModelInterface.new("Bar" + l.to_s)
      @bars.add bar
      
      return bar
    end
    
    def removeBar
    end
    
    def discardModel
      #@bars.each { |bar| bar.reset }
      ents = Sketchup.active_model.entities
      footprints = ents.find_all { |e| e.layer.name == "Footprints" }
      ents.erase_entities footprints
    end
    
  end
  
end
